<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/11/29 0029
 * Time: 0:40
 */

namespace app\api\controller;


use logicmodel\ManageLogic;
use think\Request;

class Manage extends BaseController
{
    private $manageLogic;
    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $this->manageLogic = new ManageLogic();
    }

    /**
     * 代理商品
     * @return \think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function manageGoods(){
        return json($this->manageLogic->manageGoods($this->uid));
    }

    /**
     * 收益记录
     * @param $id
     * @return \think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function goodsAward($id){
        return json($this->manageLogic->goodsAward($this->uid,$id));
    }

    /**
     * 代理作品详情
     * @param $id
     * @return \think\response\Json
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function goodsDetail($id){
        return json($this->manageLogic->goodsDetail($id));
    }

}